class student  {
  name: string
  age: number
  height?: number
  constructor(name: string, age: number, height?: number) {
    this.name = name
    this.age = age
    this.height = height
  }
  say() {
    let yy = `my name is ${this.name}, I am ${this.age}`
    if(this.height != undefined) {
      yy = yy + ` I have ${this.height}高`
    }
    return yy
  }
}

let wuyucun: student = new student('吴雨村', 26)

console.log(wuyucun.say())
console.log(wuyucun.name)

let moli :student = new student('茉莉', 28, 150)
console.log(moli.say())
console.log(moli.name)


class staff {
  public name: string
  private age: number
  public constructor(name: string, age: number) {
    this.name = name
    this.age= age
  }
  public say () {
    console.log('1、我要说话了')
  }
  protected make() {
    console.log('2.我要做爱')
  }
}

let moliy: staff = new staff('吴雨村啊', 12)

console.log(moliy.name)
// console.log(moliy.age) 报错了这里，因为age是私人属性

class staffAfter extends staff {
  public nickName: string = '阿三'
  public birthday: string = '2019/07/02'
  public say() {
    super.say()
    console.log('我媳妇儿是一个傻吊')
  }
}

let mazha: staffAfter = new staffAfter('吴雨村', 27)
console.log('maza、' + mazha.nickName)
console.log('maza、' + mazha.name)
console.log('maza、' + mazha.say())